package com.hanamaki.day1.day30;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.File;

public class sw1 {
    //注册驱动
    WebDriver driver;
    WebDriver.Navigation navigation;
    @BeforeMethod
    public void setUp(){
        System.setProperty("webdriver.gecko.driver", "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe");
        driver = new FirefoxDriver();
        navigation = driver.navigate();

    }
    @Test
    public void test(){
        //C:\Users\Admin\Desktop\testhtml\workspaceHtml
        driver.get("file:///C:/Users/Admin/Desktop/testhtml/workspaceHtml/iframeDemo.html");
        driver.switchTo().frame("w1");
        WebElement test1 = driver.findElement(By.linkText("test1"));
        test1.click();
        driver.switchTo().parentFrame();

        driver.switchTo().frame("w2");
        WebElement t1127 = driver.findElement(By.linkText("t1127"));
        t1127.click();


    }
    @AfterMethod
    public void close(){

    }
}
